﻿using Kingdee.BOS.WebApi.Client;
using Kingdee.BOS.WebApi.DataEntify;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using iTextSharp.tool.xml.html;

namespace LanDBom.Models.Algorithm
{
    public class JChelp
    {
        LDbaseEntities db = new LDbaseEntities();
        //根据传递的物料种类进行查询工艺
        public List<libray> Shungd(string bOM2_id)
        {
            var BOMliao = db.BOMini.Find(int.Parse(bOM2_id));
            Formation MAte = db.Formation.Find(BOMliao.Fo_id);
            var mates = -1;
            if (MAte != null)
            {
                mates = (int)MAte.MA_ID;
            }
            //获取工艺
            var Gongyi = db.libray.Where(s => s.MA_id == mates).ToList();
            var GLei = Gongyi.GroupBy(s => new { s.ST_ID }).Select(a => new { ST_id = a.Key.ST_ID }).ToList();

            return Gongyi;
        }
        public int Shungdint(string bOM2_id)
        {
            var BOMliao = db.BOMini.Find(int.Parse(bOM2_id));
            Formation MAte = db.Formation.Find(BOMliao.Fo_id);
            var mates = -1;
            if (MAte != null)
            {
                mates = 1;
            }
            return mates;
        }

      
    }
}